import { defineStore } from 'pinia'
import { UserInterface } from '@/api/login'

export const useStore = defineStore('counter', {
  state: () => {
    return {
      id: 0,
      username: "",
      password: "",
      isAll: 0,
      areaId: 0,
      token: "",
    }
  },
  getters: {
    getToken (state) {
      return state.token;
    },
  },
  actions: {
    changeToken (para: string) {
      this.token = para
    },
    setLoginInform (para: UserInterface) {
      this.id = para.id
      this.username = para.username
      this.password = para.password
      this.isAll = para.isAll
      this.areaId = para.areaId
      this.token = para.token
    }
  },
})